package com.example.demo.service.impl;


import com.example.demo.dao.User;
import com.example.demo.mapper.ExecutiveInfoMapper;
import com.example.demo.mapper.UserInfoMapper;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    private UserInfoMapper userInfoMapper;

    public UserServiceImpl(UserInfoMapper userInfoMapper) {
        this.userInfoMapper = userInfoMapper;
    }
    @Override
    public Boolean addUserInfo(User user) {
        try {
            userInfoMapper.save(user);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }

    }

    @Override
    public User findUser(String username, String password) {
        return userInfoMapper.findByUsernameAndPassword(username,password);
    }

    @Override
    public User findUsername(String username) {
        return userInfoMapper.findByUsername(username);
    }


}
